﻿using SelfManagement.Web.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Ninject;
using SelfManagement.Account.Manager;
using SelfManagement.Utility.Extensions;

namespace SelfManagement.Web.Controllers
{
    public class CommonController : CommonBaseController
    {
        [Inject]
        public UserManager UserManager { get; set; }

        #region validation action

        /// <summary>
        /// 注册时用户验证
        /// </summary>
        /// <param name="RUserName">注册的用户名</param>
        /// <param name="Email">邮箱名</param>
        /// <param name="Phone"></param>
        /// <returns></returns>
        public JsonResult IsNotUserExists(string UserName, string Email, string Phone)
        {
            return JsonAllowGet(UserManager.Get(UserName.IfNullOrWhiteSpace(Email).IfNullOrWhiteSpace(Phone)).IsNull());
        }
        #endregion
    }
}